package com.googlecode.moneyManager.view.desctopGUI;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class MainJFrame extends JFrame {
    private JMenuBar menuBar;
    private JMenu menuDeposits;
    private JMenuItem menuCreateDeposit;
    private JMenuItem menuSearchDeposit;
    private JPanel topPanel;
    private CreateDepositMenuListener createDepositMenuListener;
    public MainJFrame() {
	setTitle("Test Application");
	setSize(1000, 500);
	setBackground(Color.gray);

	topPanel = new JPanel();
	topPanel.setLayout(new BorderLayout());
	getContentPane().add(topPanel);
	// Create the menu bar
	menuBar = new JMenuBar();
	// Set this instance as the application's menu bar
	setJMenuBar(menuBar);
	menuDeposits = new JMenu("Deposits");
	menuCreateDeposit = new JMenuItem("Create Deposit");
	menuSearchDeposit = new JMenuItem("Search Deposit");
	createDepositMenuListener = new CreateDepositMenuListener();
	menuCreateDeposit.addActionListener(createDepositMenuListener);
	menuDeposits.add(menuCreateDeposit);
	menuDeposits.add(menuSearchDeposit);
	menuBar.add(menuDeposits);
	
    }
    class CreateDepositMenuListener implements ActionListener{
		
	    public void actionPerformed(ActionEvent e) {
		JTextField textField = new JTextField("name");
		textField.setBounds( 20, 40, 260, 25 );
		textField.setFocusAccelerator( 'v' );
		topPanel.add(textField);
		JLabel label1 = new JLabel( "Value 1:");
		label1.setBounds( 20, 15, 260, 20 );
		label1.setLabelFor(textField );
		label1.setDisplayedMnemonic( 'V' );
		topPanel.add( label1 );
		//MainJFrame.this.topPanel.add(textField);
		
		System.out.println("dfgdf");
	    }
	}
}
